#include "gskglshadowcacheprivate.h"
+#define MAX_UNUSED_FRAMES (16 * 5) /* 5 seconds? */
+
typedef struct
{
GskRoundedRect outline;
float blur_radius;
int texture_id;
- guint used : 1;
+ int unused_frames;
} CacheItem;
static gboolean
{
CacheItem *item = &g_array_index (self->textures, CacheItem, i);
- if (!item->used)
+ if (item->unused_frames > MAX_UNUSED_FRAMES)
{
gsk_gl_driver_destroy_texture (gl_driver, item->texture_id);
g_array_remove_index_fast (self->textures, i);
}
else
{
- item->used = FALSE;
+ item->unused_frames ++;
}
}
}
if (item == NULL)
return 0;
- item->used = TRUE;
+ item->unused_frames = 0;
g_assert (item->texture_id != 0);
item->outline = *shadow_rect;
item->blur_radius = blur_radius;
- item->used = TRUE;
+ item->unused_frames = 0;
item->texture_id = texture_id;
}